export const validateRegx = (rule, value, callback, regx) => {
  if (regx.test(value) === false) {
    callback(new Error(rule.message))
  } else {
    callback()
  }
}
export const number = (rule, value, callback) => {
  validateRegx(rule, value, callback, /^\d+$/)
}

export const phone = (rule, value, callback) => {
  validateRegx(rule, value, callback, /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/)
}

export const email = (rule, value, callback) => {
  validateRegx(rule, value, callback, /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)
}
